<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<% String path = request.getContextPath(); %>
<html>
<head>
    <title>修改信息</title>
    <link rel="icon" href="<%=path%>/images/favicon.ico" sizes="32x32" />
    <link rel="stylesheet" href="<%=path%>/css/font.css">
    <link rel="stylesheet" href="<%=path%>/css/xadmin.css">
    <link rel="stylesheet" href="<%=path%>/css/pg_btn.css">
    <script type="text/javascript" src="<%=path%>/js/jquery-1.3.2.min.js"></script>
    <script src="<%=path%>/lib/layui/layui.js"></script>
    <script type="text/javascript" src="<%=path%>/js/xadmin.js"></script>
    <%--图片上传--%>
    <link rel="stylesheet" href="${path}/dropzone/dropzone.css" />
    <link rel="stylesheet" href="${path}/dropzone/min/basic.min.css" />
    <script src="${path}/dropzone/min/dropzone.min.js"></script>
    <style>
        .layui-form-item .layui-input-inline {
            width: 400px !important;
        }
    </style>
</head>
<body>
<div class="x-nav">
      <span class="layui-breadcrumb">
       <a href="">首页</a>
       <a href="<%=path%>/findObtain">查询列表</a>
       <a href="">修改</a>
      </span>
</div>
<div class="x-body">
    <form class="layui-form"  id="f_auto" action="<%=path%>/updateObtain" method="post" >
        <input type="hidden" value="${obtain.id}" name="id" id="id"/>

        <div class="layui-form-item">
            <label for="category" class="layui-form-label">
                <span class="">物品分类</span>
            </label>
            <div class="layui-input-inline">
                <select name="category" id="category" lay-verify="required">
                    <option value="">--</option>
                    <option value="电器类">电器类</option>
                    <option value="饭卡">饭卡</option>
                    <option value="服饰类">服饰类</option>
                    <option value="其他类型">其他类型</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">图片：</label>
            <div class="layui-input-block">
                <c:if test="${obtain.image==null}">
                    <input type="hidden" name="image" id="image" >
                </c:if>
                <c:if test="${obtain.image!=null}">
                    <input type="text" readonly name="image" value="${obtain.image}" id="image" >
                </c:if>
                <div id="dropz" class="dropzone"></div>
            </div>
        </div>

        <div class="layui-form-item">
            <label  class="layui-form-label">
                <span class="">物品特征</span>
            </label>
            <div class="layui-input-inline">
                <textarea name="remark" placeholder="请输入内容"  class="layui-textarea">${obtain.remark}</textarea>
            </div>
        </div>


        <div class="layui-form-item">
            <label for="address" class="layui-form-label">
                <span class="">丢失时间和地点</span>
            </label>
            <div class="layui-input-inline">
                <input type="text" id="address" name="address" lay-verify="required"
                       autocomplete="off" value="${obtain.address}" class="layui-input">
            </div>
        </div>


        <div class="layui-form-item">
            <label for="phone" class="layui-form-label">
                <span class="">联系方式</span>
            </label>
            <div class="layui-input-inline">
                <input type="text" id="phone" name="phone" lay-verify="phone"
                       autocomplete="off" value="${obtain.phone}" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item" id="btn_xg">
            <button  class="layui-btn layui-btn-sm" id="btn_on"  lay-submit="" lay-filter="updateClass">修改</button>
            <button  class="layui-btn layui-btn-sm" id="close">返回</button>
        </div>
    </form>
</div>
<script>
    $('#close').click(function() {
        window.location.href='<%=path%>/findObtain';
        return false;
    });

    Dropzone.options.dropz = {
        url: "<%=path%>/avatar",
        method: "post",
        autoQueue: true,
        dictDefaultMessage: '拖动文件至此或者点击上传', // 设置默认的提示语句
        paramName: "dropFile",// 传到后台的参数名称
        init: function () {
            this.on("success", function (file, data) {
                $("#image").val(data.fileName);
                // 上传成功触发的事件
            });
        }
    };
    $("#category").val("${obtain.category}");

    layui.config({
        base: 'layui_exts/',
    }).extend({
        excel: 'excel',
    });

    layui.use(['jquery', 'excel','form','layer','laydate'], function(){
        var form = layui.form,
            $ = layui.jquery,
            laydate = layui.laydate;
        var excel = parent.layui.excel;

        //执行一个laydate实例
        laydate.render({
            elem: '#start' //指定元素
        });

        form.verify({
            phone: function(val, item) {
                if(!/^1[3|4|5|7|8][0-9]{9}$/.test(val)){
                    return '手机号格式错误'
                }
            }
        });
    });
</script>
</body>
</html>
